﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Profile;
using System.Data;

namespace WebSite.admin.member
{
    public partial class member_msg_add : BaseAdmin
    {

        // Methods
        private void Bind()
        {
            DataTable table = SQLAccess.GreatDs("select * from DB_Msg where msgid=" + re.replace(base.Request.QueryString["mid"]) + "").Tables[0];
            if (table.Rows.Count > 0)
            {
                DataTable table2 = SQLAccess.GreatDs("select * from DB_Member where memberid=" + table.Rows[0]["memberid"].ToString() + " and isnull(flag,0)!=2 ").Tables[0];
                if (table2.Rows.Count > 0)
                {
                    this.member.Text = table2.Rows[0]["memberlogin"].ToString();
                }
                this.updatetime.Text = table.Rows[0]["updatetime"].ToString();
                this.title.Text = table.Rows[0]["title"].ToString();
                this.content.Text = table.Rows[0]["content"].ToString();
                this.replays.Text = table.Rows[0]["replay"].ToString();
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            SQLAccess.DoSql(string.Concat(new object[] { "update DB_Msg set replay='", re.replace(base.Request.Form["replays"]), "',states=1,replaytime='", DateTime.Now, "',isnew=1 where msgid=", re.replace(base.Request.QueryString["mid"]), "" }));
            base.Response.Write("<script language='javascript'>window.location.href='member_msg_add.aspx?mid=" + base.Request.QueryString["mid"] + "';</script>");
            base.Response.End();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
           
            if (base.Request.QueryString["mid"] != null)
            {
                this.Bind();
            }
        }

    }
}